package com.socialuni.center.web.serive.talk;

import com.socialuni.sdk.domain.ReportDomain;
import com.socialuni.center.web.entity.SocialContentAddEntity;
import com.socialuni.center.web.entity.CenterPostTalkEntity;
import com.socialuni.sdk.model.DO.talk.TalkDO;
import com.socialuni.center.web.utils.CenterUserUtil;
import com.socialuni.sdk.model.DO.user.UserDO;
import com.socialuni.sdk.api.model.QO.talk.SocialTalkAddQO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author qinkaiyuan
 * @date 2020-05-16 20:11
 */
@Service
@Slf4j
public class CenterPostTalkService {
    @Resource
    SocialContentAddEntity socialContentAddEntity;
    @Resource
    CenterPostTalkEntity centerPostTalkEntity;
    @Resource
    ReportDomain reportDomain;

    public void addTalk(SocialTalkAddQO talkVO) {
        UserDO user = CenterUserUtil.getMineUser();
        socialContentAddEntity.paramsValidate(user, talkVO);
        //校验是否触发关键词，如果触发生成举报，修改动态为预审查，只能用户自己可见
        TalkDO talkDO = centerPostTalkEntity.addEntity(user, talkVO);
        reportDomain.checkKeywordsCreateReport(talkDO);
    }
}
